Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kebab-case

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kebab-case

Convert a string to kebab-case, i.e. its dash separated form

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
197K
decreased by-17.32%
Maintainers
1
Weekly downloads
 
Created
Source

kebab-case

NPM version

Convert a string to kebab-case, i.e. its dash separated form

The difference between kebab-case and e.g. dashify is that this module doesn't modify the string in any other way than transforming uppercased letters to their lowercased counterparts prefixed with -. Thanks to this there's also a reverse function to do the opposite, i.e. get back the original value.

This is used in Unistyle to transform JavaScript CSS properties to their CSS counterparts without losing a possible browser prefix, e.g: WebkitTransform -> -webkit-transform.

Installation

Install kebab-case using npm:

npm install --save kebab-case

Usage

Module usage

var kebabCase = require("kebab-case");

kebabCase("WebkitTransform");
// "-webkit-transform"
kebabCase.reverse("-webkit-transform");
// "WebkitTransform"

API

kebabCase(str)

NameTypeDescription
strStringThe string to convert

Returns: String, the kebab cased string.

kebabCase.reverse(str)

NameTypeDescription
strStringThe string to convert back

Returns: String, the "unkebab cased" string.

License

MIT © Joakim Carlstein

Keywords

FAQs

Package last updated on 10 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc